﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using com.crawler.common;
using com.crawler.components;

namespace com.crawler.winfrom
{
    public partial class FrmTopBook : Form
    {
        Thread m_thd = null;

        public FrmTopBook()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }

        private void btn_start_Click(object sender, EventArgs e)
        {
            try
            {
                

                BaiDuManager t_baidu_mgr = new BaiDuManager();
                t_baidu_mgr.SendMsg+=new  SendMsgEventHandler(ShowMsg);
                m_thd=new Thread(t_baidu_mgr.GetTopBook);
                m_thd.Start();

            }
            catch (Exception ex)
            {
                LogHelper.Error("加载系统配置失败" + ex.ToString());
            }
        }

         /// <summary>
        /// 显示消息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="i_msg_type"></param>
        private void ShowMsg(object sender, SendMsgEventArgs e)
        {
            txt_info.AppendText(e.Msg.ToString());
            txt_info.AppendText("\r\n");
        }

        private void btn_chapter_Click(object sender, EventArgs e)
        {

            BaiDuManager t_baidu_mgr = new BaiDuManager();
            t_baidu_mgr.SendMsg += new SendMsgEventHandler(ShowMsg);
            m_thd = new Thread(t_baidu_mgr.StartTitle);
            m_thd.Start();
        }

        private void btnTest_Click(object sender, EventArgs e)
        {
         
        }

        
    }
}
